<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <title>Edit User</title>
    <link rel="stylesheet" th:href="@{/css/style.css}">
    <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
</head>
<body>
    <div id="app">
        <h2>Edit User</h2>
        <form th:action="@{/users/{id}/update(id=${user.id})}" th:object="${user}" method="post">
            <div class="form-group">
                <label for="name">Name:</label>
                <input type="text" id="name" th:field="*{name}" required>
            </div>
            <div class="form-group">
                <label for="email">Email:</label>
                <input type="email" id="email" th:field="*{email}" required>
            </div>
            <div class="form-buttons">
                <button type="submit" class="btn btn-primary">Update</button>
                <a th:href="@{/users}" class="btn btn-edit">Cancel</a>
            </div>
        </form>
    </div>

    <script>
        const { createApp } = Vue
        createApp({}).mount('#app')
    </script>
</body>
</html>
